package com.openingedu.mba.service.task;

import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;

import android.util.Log;

/**
 * 任务队列
 * 
 * @author unidw
 *
 */
public class TaskQueue {
	
	private static final String TAG = TaskQueue.class.getSimpleName();
	
	private static BlockingQueue<TaskInvoker> taskQueue = new LinkedBlockingQueue<TaskInvoker>();

	public static BlockingQueue<TaskInvoker> getTaskQueue() {
		return taskQueue;
	}
	
	public static void add(TaskInvoker taskInvoker) {
		synchronized (taskQueue) {
			taskQueue.add(taskInvoker);
			taskQueue.notify();
			Log.i(TAG, "task added, notify consumer wakeup.");
		}
	}
}
